import { CustomRequestOptions } from '@/interceptors/request'
import { miniProgramsRequest, appRequest } from '@/utils/request'

/* 推客授权 */
// export const tkCheck = (data: Object) => {
//   return http.post<Object>('/applet/user/Authorize', { ...data })
// }

export async function tkCheck({ options, data }: { options?: CustomRequestOptions; data: any }) {
  // 隐藏错误提示
  // options.hideErrorToast = true;
  return miniProgramsRequest.request<IResData<any>>('/user/Authorize', {
    method: 'POST',
    ...(options || {}),
    data,
  })
}

/* 推客个人信息 */
// export const tkInfo = (data: Object) => {
//   return http.post<Object>('/applet/user/info', { ...data })
// }

export async function tkInfo({ options, data }: { options?: CustomRequestOptions; data: any }) {
  // 隐藏错误提示
  // options.hideErrorToast = true;
  return miniProgramsRequest.request<IResData<any>>('/user/info', {
    method: 'POST',
    ...(options || {}),
    data,
  })
}

/* 推客检查 */
// export const tkSpromoter = (data: Object) => {
//   return http.post<Object>('/applet/user/promoter', { ...data })
// }

export async function tkSpromoter({
  options,
  data,
}: {
  options?: CustomRequestOptions
  data: any
}) {
  // 隐藏错误提示
  // options.hideErrorToast = true;
  return miniProgramsRequest.request<IResData<any>>('/user/promoter', {
    method: 'POST',
    ...(options || {}),
    data,
  })
}
